<?php if (!defined('THINK_PATH')) exit(); /*a:3:{s:65:"C:\xampp\htdocs\gyrjy/application/forms\view\formsdata\index.html";i:1534256479;s:69:"C:\xampp\htdocs\gyrjy/application/forms\view\formsdata\formstype.html";i:1534256479;s:69:"C:\xampp\htdocs\gyrjy/application/forms\view\formsdata\formsdata.html";i:1534256479;}*/ ?>
<?php $namespace = ns(); ?>
<div class="layout">
    <div class="layout-left" style="width: 20%;margin-right: -20%;">
        <div class="box" id="<?php echo $namespace; ?>type_box"></div>
        <script>
    Namespace.register("EBCMS.<?php echo $namespace; ?>type");
    $(function(){
        EBCMS.<?php echo $namespace; ?>type.refresh = function refresh(){
            EBCMS.CORE.api({
                queryParams:{
                    order:{
                        'sort':'desc',
                    },
                    model:'forms/forms',
                },
                tpl:'<?php echo $namespace; ?>type-table',
                target:'#<?php echo $namespace; ?>type_table',
                compileAfter:function(p){
                    var $lists = $(p.target).find('a.list-group-item');
                    $lists.click(function(){
                        $lists.removeClass('active');
                        $(this).addClass('active');
                    });
                }
            });
        };
        EBCMS.<?php echo $namespace; ?>type.change_forms = function change_forms(forms_id){
            EBCMS.CORE.compile({
                tpl:'<?php echo $namespace; ?>-box',
                target:'#<?php echo $namespace; ?>_box',
                compileAfter:function(){
                    EBCMS.<?php echo $namespace; ?>.forms_id = forms_id;
                    EBCMS.<?php echo $namespace; ?>.refresh({
                        page:1,
                        where:{
                            forms_id:['eq',forms_id],
                        }
                    });
                }
            });
        };
        EBCMS.CORE.compile({
            tpl:'<?php echo $namespace; ?>type-box',
            target:'#<?php echo $namespace; ?>type_box',
            compileAfter:function(){
                EBCMS.<?php echo $namespace; ?>type.refresh();
            }
        });
    });
</script>

<script id="<?php echo $namespace; ?>type-box" type="text/html">
    <div class="header">
        <div class="btn-group pull-right">
            <button class="btn btn-primary" onclick="EBCMS.CORE.changemain('<?php echo url('forms/forms/index'); ?>');">管理</button>
        </div>
        <div class="header-title" onclick="EBCMS.<?php echo $namespace; ?>type.refresh();">表单</div>
    </div>
    <div class="body" style="bottom:0px;">
        <div id="<?php echo $namespace; ?>type_table" class="box"></div>
    </div>
</script>

<script id="<?php echo $namespace; ?>type-table" type="text/html">
    <div class="list-group tree tree_first" style="border-top: 1px solid #ddd;border-right: 1px solid #ddd;border-bottom: 1px solid #ddd;">
        [[include '<?php echo $namespace; ?>type-table-item' data]]
    </div>
</script>

<script id="<?php echo $namespace; ?>type-table-item" type="text/html">
    [[each rows as v n]]
        <a class="list-group-item" href="javascript:EBCMS.<?php echo $namespace; ?>type.change_forms('[[v.id]]');"><span class="badge">[[v.mark]]</span>[[v.title]]
            </a>
    [[/each]]
</script>
    </div>
    <div class="layout-rightbox">
        <div class="layout-right" style="height:100%;overflow:auto;margin-left: 20%;">
            <div class="box" id="<?php echo $namespace; ?>_box"></div>
            <script>
    Namespace.register("EBCMS.<?php echo $namespace; ?>");
    $(function(){
        EBCMS.<?php echo $namespace; ?>.queryParams = {
            page:1,
            rows:20,
            order:{
                'sort':'desc',
                'id':'desc',
            },
            model:'forms/formsdata',
        };
        EBCMS.<?php echo $namespace; ?>.refresh = function refresh(p){
            if (p) {
                $.each(p, function(index, val) {
                    if (typeof val == 'object') {
                        EBCMS.<?php echo $namespace; ?>.queryParams[index] = $.extend(EBCMS.<?php echo $namespace; ?>.queryParams[index], p[index]);
                        delete p[index];
                    };
                });
                $.extend(EBCMS.<?php echo $namespace; ?>.queryParams, p);
            };
            EBCMS.CORE.api({
                queryParams:EBCMS.<?php echo $namespace; ?>.queryParams,
                tpl:'<?php echo $namespace; ?>-table',
                target:'#<?php echo $namespace; ?>_table',
                compileAfter:function(p){
                    $('#<?php echo $namespace; ?>_table').find('.input_sort').focus(function(){
                        EBCMS.<?php echo $namespace; ?>.sortvalue = $(this).val();
                    }).blur(function(){
                        var $this = $(this);
                        if ($this.val() != EBCMS.<?php echo $namespace; ?>.sortvalue) {
                            EBCMS.ACT.togglefield('<?php echo url('forms/formsdata/resort'); ?>',$this.data('id'),$this.val(),'<?php echo $namespace; ?>','resort');
                        };
                    });
                    EBCMS.FN.renderPage({
                        namespace:'<?php echo $namespace; ?>',
                        total:p.data.total,
                    });
                    EBCMS.FN.renderFilter({
                        namespace:'<?php echo $namespace; ?>',
                        filter:{
                            search:{
                                field:'ip|data',
                                value:''
                            },
                            status:{
                                field:'status',
                            },
                            order:{
                                filters:{id:'id',update_time:'更新时间',sort:'权重'}
                            },
                            rows:true,
                        },
                    });
                },
            });
        };
    });
</script>

<script id="<?php echo $namespace; ?>-box" type="text/html">
    <div class="header">
        <div id="<?php echo $namespace; ?>_filter" class="footer-page"></div>
        <div class="header-title" onclick="EBCMS.<?php echo $namespace; ?>.refresh();">内容管理</div>
    </div>
    <div class="body">
        <div id="<?php echo $namespace; ?>_table" class="box"></div>
    </div>
    <div class="footer">
        <div id="<?php echo $namespace; ?>_page" class="footer-page"></div>
    </div>
</script>

<script id="<?php echo $namespace; ?>-table" type="text/html">
    [[each rows as v n]]
        <table class="table table-bordered">
            <tr>
                <th style="width:120px;">留言时间</th>
                <td>[[v.create_time | unixtostr]]</td>
                <th style="width:120px;">IP</th>
                <td>[[v.ip]]</td>
            </tr>
            [[each v.data as a b]]
            <tr>
                <th style="width:120px;">[[b]]</th>
                <td colspan="3">
                    [[a | dostr]]
                </td>
            </tr>
            [[/each]]
            <tr>
                <td colspan="4">
                    <div class="btn-group btn-group-sm">
                        <button class="btn btn-primary" onclick="EBCMS.ACT.del('<?php echo url('forms/formsdata/delete'); ?>','[[v.id]]','<?php echo $namespace; ?>');">删除</button>
                    </div>
                </td>
            </tr>
        </table>
    [[/each]]
</script>
        </div>
    </div>
</div>